package cluster

import (
	"cloud/pkg/app"
	"cloud/service/kubernetes"

	"github.com/gin-gonic/gin"
)

// InstallKubernetes godoc
// @Summary install cluster
// @Description install cluster master
// @Tags install cluster master
// @Accept  json
// @Produce  json
// @Param cluster body models.Kubernetes true "install cluster master"
// @Failure 201 {object} app.Response
// @Router /cluster/v1/masters [post]
func InstallKubernetes(ctx *gin.Context) {
	k := &kubernetes.InstallKuber{}
	app.HandleOperator(ctx, k, func(o app.Operator) {
		app.HandleServiceResult(ctx, 201, o.Run())
	})
}

// InstallKubernetesSlave godoc
// @Summary install cluster slave
// @Description install cluster slave
// @Tags install cluster slave
// @Accept  json
// @Produce  json
// @Param cluster body kubernetes.InstallSlave true "install cluster slave"
// @Failure 201 {object} app.Response
// @Router /cluster/v1/slaves [post]
func InstallKubernetesSlave(ctx *gin.Context) {
	k := &kubernetes.InstallSlave{}
	app.HandleOperator(ctx, k, func(o app.Operator) {
		app.HandleServiceResult(ctx, 201, o.Run())
	})
}
